<?php


namespace app\common\helper;

class CardApp
{
	public static function get_endtime_cycle_time($date, $time_type, $time_value)
	{
		$endtime = time();
		$time_value = empty($time_value) ? 1 : \intval($time_value);
		if ($time_type == 0) {
			$endtime = strtotime($date . " + {$time_value} minute");
		} elseif ($time_type == 1) {
			$endtime = strtotime($date . " + {$time_value} hour");
		} elseif ($time_type == 2) {
			$endtime = strtotime($date . " + {$time_value} day");
		} elseif ($time_type == 3) {
			$endtime = strtotime($date . " + {$time_value} week");
		} elseif ($time_type == 4) {
			$endtime = strtotime($date . " + {$time_value} month");
		} elseif ($time_type == 7) {
			$endtime = strtotime($date . " + " . $time_value * 3 . " month");
		} elseif ($time_type == 8) {
			$endtime = strtotime($date . " + " . $time_value * 6 . " month");
		} elseif ($time_type == 5) {
			$endtime = strtotime($date . " + {$time_value} year");
		} elseif ($time_type == 6) {
			$endtime = \app\common\model\DefaultConfig::PerpetualTimeValue;
		}
		return $endtime;
	}
}